<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 原型链 + 构造函数的组合继承方式
    function Person(){
        this.name = 'xiaohui'
        this.age = 20
        this.run = function(){
            console.log(this.name + '在运动');
        }
    }

    Person.prototype.sex = 'boy'
    Person.prototype.work = function(){
        console.log(this.name + '在工作');
    }

    function Web(name,age){
        Person.call(this,name,age)
    }

    Web.prototype = new Person()
    // Web.prototype = Person.prototype

    var w = new Web('xiaohui',20)
    w.run()
</script>
</html>